home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 January / PCWorld_2007-01_cd.bin / v cisle / autoit / autoit-v3.2.0.1-setup.exe / Examples / Helpfile / TraySetOnEvent.au3 < prev    next >
Encoding:
Text File  |  2006-06-17  |  746 b   |  36 lines

  1. #include <Constants.au3>
  2. #NoTrayIcon
  3.  
  4. Opt("TrayOnEventMode",1)
  5. Opt("TrayMenuMode",1)    ; Default tray menu items (Script Paused/Exit) will not be shown.
  6.  
  7. $exit = TrayCreateItem("Exit")
  8. TrayItemSetOnEvent(-1,"ExitEvent")
  9.  
  10. TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"SpecialEvent")
  11. TraySetOnEvent($TRAY_EVENT_SECONDARYUP,"SpecialEvent")
  12.  
  13. TraySetState()
  14.  
  15. While 1
  16.     Sleep(10)    ; Idle loop
  17. WEnd
  18.  
  19. Exit
  20.  
  21.  
  22. ; Functions
  23. Func SpecialEvent()
  24.     Select
  25.         Case @TRAY_ID = $TRAY_EVENT_PRIMARYDOUBLE
  26.             Msgbox(64,"SpecialEvent-Info","Primary mouse button double clicked.")
  27.         Case @TRAY_ID = $TRAY_EVENT_SECONDARYUP
  28.             Msgbox(64,"SpecialEvent-Info","Secondary mouse button clicked.")
  29.     EndSelect
  30. EndFunc
  31.  
  32.  
  33. Func ExitEvent()
  34.     Exit
  35. EndFunc
  36.